//
//  ByModelOrder.m
//  oc_knowledge
//
//  Created by mc on 17/1/16.
//  Copyright © 2017年 com.itboye. All rights reserved.
//

#import "ByModelOrder.h"

@implementation ByModelOrderListItemProduct

- (void)setAttributes:(NSDictionary *)jsonDic {
    
    [super setAttributes:jsonDic];
    
    self.img = BOYE_PICTURE_VIEW_URL(jsonDic[@"img"]);
    
    self.price = [NSString stringWithFormat:@"%.2f",[jsonDic[@"price"] floatValue] / 100];
    self.ori_price = [NSString stringWithFormat:@"%.2f",[jsonDic[@"ori_price"] floatValue]/100];
}

@end

#pragma mark -
@implementation ByModelOrderListItem

- (void)setAttributes:(NSDictionary *)jsonDic {
    
    [super setAttributes:jsonDic];
    
    self.totalPrice = @([jsonDic[@"price"] floatValue] / 100);
    self.store_logo = BOYE_PICTURE_VIEW_URL(jsonDic[@"store_logo"]);
    
    NSMutableArray *temp = [[NSMutableArray alloc] init];
    for (NSDictionary *dic in jsonDic[@"items"]) {
        ByModelOrderListItemProduct *model = [[ByModelOrderListItemProduct alloc] initContentWithDic:dic];
        [temp addObject:model];
    }
    self.items = [temp copy];
}

@end

#pragma mark -

@implementation ByModelOrder

- (void)setAttributes:(NSDictionary *)jsonDic {
    
    [super setAttributes:jsonDic];
    
    NSMutableArray *temp = [[NSMutableArray alloc] init];
    for (NSDictionary *dic in jsonDic[@"list"]) {
        ByModelOrderListItem *model = [[ByModelOrderListItem alloc] initContentWithDic:dic];
        [temp addObject:model];
    }
    self.list = [temp copy];
    
}

@end

